﻿// -------------------------------------------------------------------------
//    @FileName         :    NFTransSaveDetailDB.cpp
//    @Author           :    gaoyi
//    @Date             :    2025-03-27
//    @Email			:    445267987@qq.com
//    @Module           :    NFTransSaveDetailDB
//
// -------------------------------------------------------------------------

#include <NFSnsRoleDetail.h>
#include <NFSnsRoleDetailService.h>

#include "NFTransSaveDetailDB.h"
#include <NFLogicComm/NFLogicCommon/NFBaseDefine.h>
#include "NFComm/NFPluginModule/NFLogMgr.h"
#include "NFComm/NFPluginModule/NFCheck.h"
#include "NFComm/NFCore/NFTime.h"
#include "NFServerComm/NFServerCommon/NFIServerMessageModule.h"

NFTransSaveDetailDB::NFTransSaveDetailDB()
{
    if (NFShmMgr::Instance()->GetCreateMode() == EN_OBJ_MODE_INIT)
    {
        CreateInit();
    }
    else
    {
        ResumeInit();
    }
}

NFTransSaveDetailDB::~NFTransSaveDetailDB()
{
}

int NFTransSaveDetailDB::CreateInit()
{
    return 0;
}

int NFTransSaveDetailDB::ResumeInit()
{
    return 0;
}

int NFTransSaveDetailDB::SaveDb(NFSnsRoleDetail* pRoleDetail, int iReason)
{
    CHECK_NULL(0, pRoleDetail);
    m_reason = iReason;

    proto_ff::tbSnsRoleDetail tbData;
    pRoleDetail->SaveDb(&tbData);
    Init(NF_ST_SNS_SERVER, pRoleDetail->GetRoleId(), E_TABLE_SNS_ROLE_DETAIL, pRoleDetail->GetGlobalId(), 0);
    m_reason = iReason;

    return SaveCacheDataReq(pRoleDetail, iReason, tbData);
}

